﻿using Glimpse.Core.ClientScript;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Database = System.Data.Entity.Database;
using System.Configuration;
using ServiceStack.OrmLite;

namespace AuthorInqury
{   
    public class sql
    {
      private  String Sqlconn = "server=.;database=Blogs;user=LAPTOP-9NKOV3MS/NINENINE;pwd=.;";
    }
    
    public partial class Authorinqury : Form//子窗体
    {
        private SqlConnection sqlconn;

        public string Sqlconn { get; private set; }

        public Authorinqury(int ID, string Title, string Author)
        {
            InitializeComponent();
           
        }

        private void label3_Click(object sender, EventArgs e)
        {
            //当前无视
        }

        private void button1_Click(object sender, EventArgs e)//增加
        {
            //获取和更新时间
            SqlData udata = new SqlData();
            udata.Author = this.Text;
            udata.title = this.Text;
            udata.datetime = this.Text;

        }
        private void button2_Click(object sender, EventArgs e)//查询
        {
            Sqlconn.OpenDbConnection();//打开数据库
            string sql = string.Format("select * from Users where Blogs='{0}'", AuthorInqury.Text);
            SqlCommand sqlCommand = new SqlCommand(sql,sqlconn);
           
                SqlDataAdapter sqlDataAdapter = sqlCommand.ExecuteReader();
                if(sqlDataAdapter=Read())
                {
                   
                }
            
        }

        private void button3_Click(object sender, EventArgs e)//修改
        {
           
        }
private void btn_Exit_Click(object sender, EventArgs e)//退出
        {
    this.Close();
           }

        private void button4_Click(object sender, EventArgs e)//删除
        {
            if (MessageBox.Show("您确定要删除这条记录吗？", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)//删除时提示用户是否删除
            {
                
            }
    }
}
